Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db/log): use logrus as logger for db #1135

Merged
merged 7 commits into from
Jun 5, 2024
Merged

feat(db/log): use logrus as logger for db #1135

merged 7 commits into from
Jun 5, 2024

Conversation

wass3r
Copy link
Collaborator

@wass3r wass3r commented Jun 5, 2024

db logs are not using logrus format currently. this change ensure database logs are formatted in same manner as other logs. some highlights:

  • uses logrus as logger with same format as global logger (json, ecs, etc)
  • adds knobs to control db logging:
    • VELA_DATABASE_LOG_LEVEL - "warn" is default, pretty noisy otherwise
    • VELA_DATABASE_LOG_SLOW_THRESHOLD - 200ms default, inherited from gorm default
    • VELA_DATABASE_LOG_SHOW_SQL - false is default
    • VELA_DATABASE_LOG_SKIP_NOTFOUND - true is default
  • will create a copy of global logger and configure custom level if the log level is different than global logger

@wass3r wass3r requested a review from a team as a code owner June 5, 2024 16:31
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 62.02532% with 30 lines in your changes missing coverage. Please review.

Project coverage is 67.23%. Comparing base (4f81558) to head (0d6d52a).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1135      +/-   ##
==========================================
- Coverage   68.04%   67.23%   -0.81%     
==========================================
  Files         411      423      +12     
  Lines       13752    14160     +408     
==========================================
+ Hits         9358     9521     +163     
- Misses       3859     4091     +232     
- Partials      535      548      +13     
Files Coverage Δ
database/context.go 92.30% <100.00%> (+1.39%) ⬆️
database/opts.go 92.30% <100.00%> (+3.41%) ⬆️
database/logger.go 53.33% <53.33%> (ø)
database/database.go 51.94% <44.82%> (-6.06%) ⬇️

... and 1 file with indirect coverage changes

KellyMerrick
KellyMerrick previously approved these changes Jun 5, 2024
Copy link
Contributor

@KellyMerrick KellyMerrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@KellyMerrick KellyMerrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ecrupper ecrupper merged commit 5ac9c0e into main Jun 5, 2024
14 of 16 checks passed
@ecrupper ecrupper deleted the feat/db-logging branch June 5, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants